<h1>New Virtual Field on '<?=$table->name?>'</h1>
<? if ( ! isset($vFieldType) ): ?>
	<p><?=HTML::a('New Parent Field', 'table', 'parent_vfield', $table->id)?></p>
	<p><?=HTML::a('New Summary Field', 'table', 'summary_vfield', $table->id)?></p>
	<p><?=HTML::a('New SQL Field', 'table', 'sql_vfield', $table->id)?></p>
<? else: ?>
	<?=HTML::form('newVirtualField', 'table', 'create_vfield', $table->id)?>
		<div><?=HTML::labeledInput('Name:', 'name')?></div>
		<? if ( $vFieldType == 'sql' ): ?>
			<div><?=HTML::labeledInput('SQL:', 'sql')?></div>
		<? elseif ( $vFieldType == 'summary' ): ?>
			<div><?=HTML::labeledSelect('Summary Type:', 'summaryType', array_flip(Types::$summaryTypes))?></div>
			<div><?=HTML::labeledSelect('Summary Field:', 'summaryField', $table->summaryOptions(),  array('useID' => true))?></div>
		<? elseif ( $vFieldType == 'parent' ): ?>
			<div><?=HTML::labeledSelect('Parent Field:', 'parentField', $table->parentOptions(), array('useID' => true))?></div>
		<? endif; ?>
		<div><?=HTML::submit('Create')?></div>
		<?=HTML::hiddenInput('vFieldType', $vFieldType)?>
	</form>
<? endif; ?>